import urllib

from google.appengine.api import users

from gaeo.controller import BaseController

from model.user import User

class WelcomeController(BaseController):
    def index(self):
        pass

    def login(self):
        url = urllib.quote(self.params.get('url', '/'))
        if users.get_current_user() is None:
            self.redirect(users.create_login_url(url))
        else:
            self.redirect(url)

    def logout(self):
        url = urllib.quote(self.params.get('url', '/'))
        self.redirect(users.create_logout_url(url))
